<template>
	<div>
		<el-aside width="10%">
            <el-menu
				default-active="2"
				class="el-menu-vertical-demo"
				@open="handleOpen"
				@close="handleClose"
				background-color="#FFFFFF"
				text-color="#333333"
				:router="true"
				active-text-color="#000000">
	            <el-menu-item index="/base">
	                <i class="el-icon-picture-outline"></i>
	                <span slot="title">添加图片</span>
	            </el-menu-item>
	            
	            <template v-if="this.userInfo.username == 'admin'">
					<el-menu-item index="/import">
		                <i class="el-icon-s-release"></i>
		                <span slot="title">导入xls文件</span>
	           		</el-menu-item>
				</template>
	            <template v-for="item in btt">
					<el-menu-item v-if="item ==19" index="/import">
		                <i class="el-icon-s-release"></i>
		                <span slot="title">导入xls文件</span>
	           		</el-menu-item>
				</template>	
	            
				
				<el-menu-item index="/base-detail">
				    <i class="el-icon-setting"></i>
				    <span slot="title">基础信息配置</span>
				</el-menu-item>
	           
            </el-menu>
        </el-menu>
        </el-aside>
        <el-main>
        	<router-view class="con"></router-view>
        </el-main>
	</div>
</template>

<script type="text/javascript">
	export default {
		data(){
			return {
				auth:{alc:{}},
				btt:[],
			}
		},
		mounted() {
          this.getCookie('user_info');
        },
		created(){
			var user = this.getCookie('user_info');
			if(user){
				this.userInfo = JSON.parse(user);
				this.btt = this.userInfo.blist.split(',');
			}
		},
		methods:{
			handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            getCookie(name){
				var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
				if(arr=document.cookie.match(reg)){
					return unescape(arr[2]);
				}else{
					return null;
				}
			},
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            }
		}
	}
</script>


<style type="text/css" lang="scss" scoped>
	.el-aside{
		float: left;
		.el-menu-vertical-demo{
			height: calc(100vh - 70px);
		}
	}
	.el-main{
		float: left;
		margin-left: 10px;
		margin-top: 10px;
		width: 500px;
		background-color: #ffffff;

	}
</style>